
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class RegularExpression 
{
    public boolean isInternalUrlAddress(String url_address)
    {
        Pattern pattern = Pattern.compile("/wiki/.*");
        Matcher matcher = pattern.matcher(url_address);
        return matcher.matches();
    }
    public boolean isCorrectUrlAddress(String url_address)
    {
        Pattern pattern = Pattern.compile("http://\\w{2}\\.wikipedia\\.org.*");
        Matcher matcher = pattern.matcher(url_address);
        return matcher.matches();
    }
    public boolean isCorrectImgUrlAddress(String url_address, String type)
    {
        boolean isExternalLinks = url_address.startsWith("http://upload.wikimedia.org");
        boolean isRightType = url_address.endsWith(type);
        return (isExternalLinks && isRightType);
    }
}
